// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init()
const db=cloud.database();
const _=db.command
// 云函数入口函数
exports.main = async (event, context) => {
  
  var timeStamp=Date.parse(new Date())/1000
  return await db.collection('topic').
  where({
    tTime:_.and(_.gte(timeStamp-60*60*24*7),_.lte(timeStamp))
  })
  .limit(7)
  .orderBy('topicReplyCount','desc')
  .get()


}